From: Matthew Garrett Date: Tue, 3 Sep 2013 15:23:29 +0000 (-0400) Subject: uswsusp: Disable when securelevel is set X-Git-Tag: archive/raspbian/4.9.13-1+rpi1~11^2~49 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b20130b241ac70ccf9c635c84106a5ca99b18152;p=linux-4.9.git uswsusp: Disable when securelevel is set uswsusp allows a user process to dump and then restore kernel state, which makes it possible to modify the running kernel. Disable this if securelevel has been set. Signed-off-by: Matthew Garrett Gbp-Pq: Topic features/all/securelevel Gbp-Pq: Name uswsusp-disable-when-securelevel-is-set.patch --- diff --git a/kernel/power/user.c b/kernel/power/user.c index 35310b627388..d1b274d7c49d 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -52,6 +53,9 @@ static int snapshot_open(struct inode *inode, struct file *filp) if (!hibernation_available()) return -EPERM; + if (get_securelevel() > 0) + return -EPERM; + lock_system_sleep(); if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {